<?php
define('IN_MEDIA',true);
include('includes/config.php');

if($id && $salt) {
$sql = "SELECT * FROM ".$tb_prefix."data WHERE m_id = '$id'";
$q = $mysql->query($sql);
$r = $mysql->fetch_array($q);

if($r){
		$mysql->query("UPDATE ".$tb_prefix."data SET m_downloaded = m_downloaded + 1,  m_downloaded_month = m_downloaded_month + 1, m_downloaded_week = m_downloaded_week + 1 WHERE m_id = '".$id."'");

		$url = $r['m_url'];
		$findme   = 'zippyshare';
		$pos = strpos($url, $findme);
		
		// Note our use of ===.  Simply == would not work as expected
		// because the position of 'a' was the 0th (first) character.
		if ($pos === false) {
			$findme1   = 'mp3';
			$pos1 = strpos($url, $findme1);
			if ($pos1 === false) {
			$temp = explode('/',$url);
			$zsID = str_replace(".flv","",$temp[4]);
			$test = "http://www".$temp[3].".zippyshare.com/v/".$zsID."/file.html";
			header("Location: ".$test);
			}
			else{
			$new_url = str_replace("ngamcanh","matxac",$url);
			header("Location: ".$new_url);
			}
		} else {
		$new_url = str_replace("ngamcanh","matxac",$url);
		header("Location: ".$new_url);


		}
}
exit();
if (!$mysql->num_rows($q)) {
    echo "<meta http-equiv='refresh' content='0;url=index.php'>";
}

}
else {
    echo "<meta http-equiv='refresh' content='0;url=index.php'>";
}

?>